package util;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.ResourceBundle;

public class DataConn {
	static Connection conn;
		public static Connection getConn() {
			ResourceBundle r=ResourceBundle.getBundle("db");
			try {
				Class.forName(r.getString("dbDriver"));
				try {
					conn=DriverManager.getConnection(r.getString("dbUrl"),r.getString("dbUser"),r.getString("dbPwd"));
				} catch (SQLException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
				
			} catch (ClassNotFoundException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			
			return conn;
		
		
	}
		public static void getclose() {
			try {
				if(conn!=null&conn.isClosed()) {
					conn.close();
				}
			} catch (SQLException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}

}
